{"componentChunkName":"component---node-modules-rocketseat-gatsby-theme-docs-core-src-templates-docs-query-js","path":"/manual-review/Math-MHT","result":{"data":{"mdx":{"id":"4d5f1c4f-5a05-5d35-b0af-4a14bb1da4a1","excerpt":"MHT-01M: Potentially Insecure Casting Operation Type Severity Location Mathematical Operations Math.sol:L261 Description: The  Math::floorD8  function will…","fields":{"slug":"/manual-review/Math-MHT/"},"frontmatter":{"title":"Math Manual Review Findings","description":"Contains all the findings that relate to manual review on the contract codebase","image":null,"disableTableOfContents":null},"body":"var _excluded = [\"components\"];\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsxRuntime classic */\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"Math Manual Review Findings\",\n  \"description\": \"Contains all the findings that relate to manual review on the contract codebase\"\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, _excluded);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"h2\", {\n    \"id\": \"span-idmht-01mmht-01m-potentially-insecure-casting-operationspan\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#span-idmht-01mmht-01m-potentially-insecure-casting-operationspan\",\n    \"aria-label\": \"span idmht 01mmht 01m potentially insecure casting operationspan permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), mdx(\"span\", {\n    id: \"MHT-01M\"\n  }, \"MHT-01M: Potentially Insecure Casting Operation\")), mdx(\"table\", null, mdx(\"thead\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"thead\"\n  }, mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Type\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Severity\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Location\"))), mdx(\"tbody\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"a\", {\n    parentName: \"td\",\n    \"href\": \"/reports/maverick-protocol-common-libraries-66165d178c7ae500187a1ad7/appendix/finding-types#mathematical-operations\"\n  }, \"Mathematical Operations\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"img\", {\n    parentName: \"td\",\n    \"className\": \"o-severity o-informational\",\n    \"src\": \"https://omniscia.io/report-assets/informational.png\"\n  })), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"a\", {\n    parentName: \"td\",\n    \"href\": \"https://github.com/maverickprotocol/maverick-v2/blob/47287a62e15ca8d4bcabf7e0b6757debb5d10593/v2-common/contracts/libraries/Math.sol#L261\"\n  }, \"Math.sol:L261\"))))), mdx(\"h3\", {\n    \"id\": \"description\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#description\",\n    \"aria-label\": \"description permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Description:\"), mdx(\"p\", null, \"The \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://github.com/maverickprotocol/maverick-v2/blob/47287a62e15ca8d4bcabf7e0b6757debb5d10593/v2-common/contracts/libraries/Math.sol#L257-L265\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"a\"\n  }, \"Math::floorD8\")), \" function will floor an 8-decimal accuracy number, performing the division with rounding towards negative infinity.\"), mdx(\"p\", null, \"In its operation, an insecure cast is being performed from the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"val / INT_ONE_D8\"), \" expression's \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"int256\"), \" type to the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"int32\"), \" data type.\"), mdx(\"h3\", {\n    \"id\": \"example\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#example\",\n    \"aria-label\": \"example permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Example:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-sol\",\n    \"metastring\": \"title=v2-common/contracts/libraries/Math.sol highlight={8} lineNumbers=true lineOffset=253\",\n    \"title\": \"v2-common/contracts/libraries/Math.sol\",\n    \"highlight\": \"{8}\",\n    \"lineNumbers\": \"true\",\n    \"lineOffset\": \"253\"\n  }, \"/**\\n * @notice Floor of a D8 number.\\n */\\nfunction floorD8(int256 val) internal pure returns (int32) {\\n    int32 val32;\\n    bool check;\\n    unchecked {\\n        val32 = int32(val / INT_ONE_D8);\\n        check = (val < 0 && val % INT_ONE_D8 != 0);\\n    }\\n    return check ? val32 - 1 : val32;\\n}\\n\")), mdx(\"h3\", {\n    \"id\": \"recommendation\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#recommendation\",\n    \"aria-label\": \"recommendation permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Recommendation:\"), mdx(\"p\", null, \"The invocations of \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://github.com/maverickprotocol/maverick-v2/blob/47287a62e15ca8d4bcabf7e0b6757debb5d10593/v2-common/contracts/libraries/Math.sol#L257-L265\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"a\"\n  }, \"Math::floorD8\")), \" within the codebase are secure given that they are performed with TWAPs that are expected to comply to strict value limitations significantly less than \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"(type(uint32).max + 1) * INT_ONE_D8\"), \".\"), mdx(\"p\", null, \"In any case, we advise a check to be potentially imposed as the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Math\"), \" library is meant to be re-usable code that may end up being utilized by future Maverick Protocol modules that are not aware of this misbehaviour.\"), mdx(\"h3\", {\n    \"id\": \"alleviation-175f8c39b19df69134add3aa8a2a042ce3047763\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#alleviation-175f8c39b19df69134add3aa8a2a042ce3047763\",\n    \"aria-label\": \"alleviation 175f8c39b19df69134add3aa8a2a042ce3047763 permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Alleviation (175f8c39b19df69134add3aa8a2a042ce3047763):\"), mdx(\"p\", null, \"The function's name was instead adjusted to \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Math::floorD8Unchecked\"), \", highlighting its \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"unchecked\"), \" nature and thus addressing this exhibit by minimizing the possibility of misuse in future iterations of the codebase.\"), mdx(ViewDiffButton, {\n    repoUrl: \"https://github.com/maverickprotocol/maverick-v2\",\n    mainHash: \"47287a62e15ca8d4bcabf7e0b6757debb5d10593\",\n    fixHash: \"175f8c39b19df69134add3aa8a2a042ce3047763\",\n    gitHubIssue: \"0\",\n    mdxType: \"ViewDiffButton\"\n  }), mdx(\"h2\", {\n    \"id\": \"span-idmht-02mmht-02m-potentially-insecure-negationsspan\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#span-idmht-02mmht-02m-potentially-insecure-negationsspan\",\n    \"aria-label\": \"span idmht 02mmht 02m potentially insecure negationsspan permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), mdx(\"span\", {\n    id: \"MHT-02M\"\n  }, \"MHT-02M: Potentially Insecure Negations\")), mdx(\"table\", null, mdx(\"thead\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"thead\"\n  }, mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Type\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Severity\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Location\"))), mdx(\"tbody\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"a\", {\n    parentName: \"td\",\n    \"href\": \"/reports/maverick-protocol-common-libraries-66165d178c7ae500187a1ad7/appendix/finding-types#mathematical-operations\"\n  }, \"Mathematical Operations\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"img\", {\n    parentName: \"td\",\n    \"className\": \"o-severity o-informational\",\n    \"src\": \"https://omniscia.io/report-assets/informational.png\"\n  })), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"a\", {\n    parentName: \"td\",\n    \"href\": \"https://github.com/maverickprotocol/maverick-v2/blob/47287a62e15ca8d4bcabf7e0b6757debb5d10593/v2-common/contracts/libraries/Math.sol#L177-L181\"\n  }, \"Math.sol:L177-L181\"), \", \", mdx(\"a\", {\n    parentName: \"td\",\n    \"href\": \"https://github.com/maverickprotocol/maverick-v2/blob/47287a62e15ca8d4bcabf7e0b6757debb5d10593/v2-common/contracts/libraries/Math.sol#L183-L187\"\n  }, \"L183-L187\"))))), mdx(\"h3\", {\n    \"id\": \"description-1\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#description-1\",\n    \"aria-label\": \"description 1 permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Description:\"), mdx(\"p\", null, \"The \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://github.com/maverickprotocol/maverick-v2/blob/47287a62e15ca8d4bcabf7e0b6757debb5d10593/v2-common/contracts/libraries/Math.sol#L177-L181\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"a\"\n  }, \"Math::abs32\")), \" and \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://github.com/maverickprotocol/maverick-v2/blob/47287a62e15ca8d4bcabf7e0b6757debb5d10593/v2-common/contracts/libraries/Math.sol#L177-L181\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"a\"\n  }, \"Math::abs\")), \" functions presently perform a negation within an \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"unchecked\"), \" code block.\"), mdx(\"p\", null, \"As signed integer types will contain one extra value in the negative range, the negation may result in an overflow if it is equal to the minimum value its type supports.\"), mdx(\"h3\", {\n    \"id\": \"example-1\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#example-1\",\n    \"aria-label\": \"example 1 permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Example:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-sol\",\n    \"metastring\": \"title=v2-common/contracts/libraries/Math.sol highlight={3,9} lineNumbers=true lineOffset=176\",\n    \"title\": \"v2-common/contracts/libraries/Math.sol\",\n    \"highlight\": \"{3,9}\",\n    \"lineNumbers\": \"true\",\n    \"lineOffset\": \"176\"\n  }, \"function abs32(int32 x) internal pure returns (uint32) {\\n    unchecked {\\n        return uint32(x < 0 ? -x : x);\\n    }\\n}\\n\\nfunction abs(int256 x) internal pure returns (uint256) {\\n    unchecked {\\n        return uint256(x < 0 ? -x : x);\\n    }\\n}\\n\")), mdx(\"h3\", {\n    \"id\": \"recommendation-1\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#recommendation-1\",\n    \"aria-label\": \"recommendation 1 permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Recommendation:\"), mdx(\"p\", null, \"The instances of the codebase that utilize the \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://github.com/maverickprotocol/maverick-v2/blob/47287a62e15ca8d4bcabf7e0b6757debb5d10593/v2-common/contracts/libraries/Math.sol#L177-L181\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"a\"\n  }, \"Math::abs32\")), \" and \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://github.com/maverickprotocol/maverick-v2/blob/47287a62e15ca8d4bcabf7e0b6757debb5d10593/v2-common/contracts/libraries/Math.sol#L177-L181\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"a\"\n  }, \"Math::abs\")), \" functions deal with ticks which are expected to be in suitable ranges that will never overflow in a negation.\"), mdx(\"p\", null, \"Regardless, we advise a check to be potentially imposed as the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Math\"), \" library is meant to be re-usable code that may end up being utilized by future Maverick Protocol modules that are not aware of this misbehaviour.\"), mdx(\"h3\", {\n    \"id\": \"alleviation-175f8c39b19df69134add3aa8a2a042ce3047763-1\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#alleviation-175f8c39b19df69134add3aa8a2a042ce3047763-1\",\n    \"aria-label\": \"alleviation 175f8c39b19df69134add3aa8a2a042ce3047763 1 permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Alleviation (175f8c39b19df69134add3aa8a2a042ce3047763):\"), mdx(\"p\", null, \"The Maverick Protocol team evaluated this exhibit and opted to retain the current behaviour in place as it functions as expected even in the case of a negation underflow due to the underlying bit representation being valid.\"), mdx(\"p\", null, \"As such, we consider this exhibit safely acknowledged.\"));\n}\n;\nMDXContent.isMDXComponent = true;","headings":[{"depth":2,"value":"<span id=\"MHT-01M\">MHT-01M: Potentially Insecure Casting Operation</span>"},{"depth":3,"value":"Description:"},{"depth":3,"value":"Example:"},{"depth":3,"value":"Recommendation:"},{"depth":3,"value":"Alleviation (175f8c39b19df69134add3aa8a2a042ce3047763):"},{"depth":2,"value":"<span id=\"MHT-02M\">MHT-02M: Potentially Insecure Negations</span>"},{"depth":3,"value":"Description:"},{"depth":3,"value":"Example:"},{"depth":3,"value":"Recommendation:"},{"depth":3,"value":"Alleviation (175f8c39b19df69134add3aa8a2a042ce3047763):"}]}},"pageContext":{"slug":"/manual-review/Math-MHT/","prev":{"label":"Constants.sol (CST-S)","link":"/static-analysis/Constants-CST"},"next":{"label":"TickMath.sol (TMH-M)","link":"/manual-review/TickMath-TMH"}}},"staticQueryHashes":["1954253342","2328931024","2501019404","973074209"]}